package com.zbkj.front.controller;

import com.zbkj.common.page.CommonPage;
import com.zbkj.common.request.PageParamRequest;
import com.zbkj.common.request.enquiry.ReportRequest;
import com.zbkj.common.request.enquiry.EnquirySaveRequest;
import com.zbkj.common.response.CommonResult;
import com.zbkj.common.response.enquiry.ClientEnquiryResponse;
import com.zbkj.common.response.enquiry.EnquiryReportResponse;
import com.zbkj.common.response.order.OrderSucceResponse;
import com.zbkj.common.response.project.ClientProjectInfoResponse;
import com.zbkj.front.service.PeEnquiryHandleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 设备询价服务
 */
@CrossOrigin("*")
@RestController
@RequestMapping("api/front/enquiry")
@Api(tags = "设备询价服务")
public class PeEnquiryController {

    @Autowired
    private PeEnquiryHandleService peEnquiryHandleService;


    @ApiOperation(value = "保存询价信息")
    @PostMapping("/saveEnquiryInfo")
    public CommonResult<OrderSucceResponse> saveEnquiryInfo(@RequestBody @Validated EnquirySaveRequest saveRequest) {
        if(peEnquiryHandleService.saveEnquiryInfo(saveRequest)){
            return CommonResult.success();
        }else{
            return CommonResult.failed();
        }
    }

    @ApiOperation(value="询价列表")
    @GetMapping("/enquiryList")
    public CommonResult<CommonPage<ClientEnquiryResponse>> enquiryList(PageParamRequest pageParamRequest) {
        return CommonResult.success(CommonPage.restPage(peEnquiryHandleService.enquiryList(pageParamRequest)));
    }



}
